<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<style>
    input[type='text'], select {
        height: 30px !important;
        border-radius: 5px!important;
    }

    .control-label {
        margin-bottom: 0px !important;
        line-height: 30px !important;
    }

    .editForm > div {
        min-height: 40px;
    }
    .bootbox label {
        margin: 0 !important;
    }

    .checkboxStyle label{
        margin:0px;
    }

    .bootbox-expand-button {
        width: 19px;
        height: 19px;
        border: none;
        cursor: pointer;
        -webkit-appearance: none;
        float: right;
        top: -18px;
        left: -30px;
        position: relative;
        background: #E9F5FF url("assets/img/nav-img/icon_window.png") no-repeat 0 0;
    }

    .bootbox-close-button {
        width: 19px;
        height: 19px;
        border: none;
        cursor: pointer;
        -webkit-appearance: none;
        float: right;
        top: 4px;
        left: -5px;
        position: relative;
        background: #E9F5FF url("assets/img/nav-img/icon_close.png") no-repeat 0 0;
    }

    .margin-bottom-15 {
        margin-bottom: 15px !important;
    }

    .expandView {
        width: 100%;
    }

    .myDialog  .modal-dialog{
        width: 50%;
    }
</style>

<div class="row" style="margin-left: 0px!important;">
    <div class="row" style="text-align: center;padding-top: 1px;min-height: 56px">
        <div class="col-xs-6 col-xs-offset-3 ">
            <#if other == 1>
                <div class="col-xs-6 nopadding">
                    <button type="btn" class="btn col-xs-12 " onclick="addPayment(this)" flag="1"
                            style="border-color: #5db2ff!important;float:left;">订金
                    </button>
                </div>
                <div class="col-xs-6 nopadding">
                    <button type="btn" class="btn col-xs-12 " onclick="addPayment(this)" flag="2"
                            style="border-color: #5db2ff!important;background-color: #5db2ff;float:left;color: #fff;">课时包
                    </button>
                </div>
            <#else>
                <div class="col-xs-4 nopadding">
                    <button type="btn" class="btn col-xs-12 " onclick="addPayment(this)" flag="1"
                            style="border-color: #5db2ff!important;float:left;">订金
                    </button>
                </div>
                <div class="col-xs-4 nopadding">
                    <button type="btn" class="btn col-xs-12 " onclick="addPayment(this)" flag="2"
                            style="border-color: #5db2ff!important;background-color: #5db2ff;float:left;color: #fff;">课时包
                    </button>
                </div>
                <div class="col-xs-4 nopadding">
                    <button type="btn" class="btn col-xs-12 " onclick="addPayment(this)" flag="3"
                            style="border-color: #5db2ff!important;float:left">其它
                    </button>
                </div>
            </#if>
        </div>
    </div>
    <form class="editForm" action="${saveUrl}" method="post" responseType="JSON" role="form"
          id="toPackagerEditForm_${serializeNum}" data-bv-submitButtons="#editFormSubmitBtn_${serializeNum}"
          data-bv-message="This value is not valid"
          data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
          data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
          data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
        <input type="hidden" name="targetdataid" value="${targetdataid}">
        <input type="hidden" class="empAdminUserId"  value="${empAdminUserId}">
        <input type="hidden" class="flag" name="flag" value="2"/>
        <input type="hidden" name="memberType" value="${memberType}">
        <input type="hidden" class="packageType" name="packageType" value="1"/>
        <input type="hidden" class="paymentType" name="paymentType" value="2"/>
        <input type="hidden" class="usableTotalClassHour" name="usableTotalClassHour" value=""/>
        <input type="hidden" class="attendanceDay" name="attendanceDay" value=""/>
        <input type="hidden" class="depositIds" name="depositIds" value="${depositIds}"/>
        <input type="hidden" class="menu" name="menu" value="${menu}">
        <input type="hidden" class="user" name="user" value="${user}">
        <input type="hidden" class="other" name="other" value="${other}">


        <div class="user hidden">
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="name" class="col-sm-3 col-sm-offset-1 control-label no-padding-right">客户姓名：</label>
                    <div class="col-sm-4">
                        <input data-bv-message="The field is not valid" size="50" name="name" alt="客户姓名" id="name"
                               placeholder="客户姓名" type="text" title="客户姓名" class="form-control searchName"
                               value="${editEntity.number}" onblur="searchName()"/>
                        <span class="text"></span>
                        <select name="stuId" id="stuId" class="col-sm-5 stuId " value=""
                                style="height: 32px;" onchange="studentCheck(this)">

                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="contactPhone"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">联系电话：</label>
                    <div class="col-sm-4">
                        <input data-bv-message="The field is not valid" size="50" name="contactPhone" alt="联系电话"
                               id="contactPhone"
                               placeholder="联系电话" type="text" title="联系电话" class="form-control"
                               value="${editEntity.contactPhone}"/>
                        <span class="text"></span>
                    </div>
                </div>
            </div>
        </div>
        <div class="packageType show">
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="contractNumber"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right"><span
                            style="color: red">*</span>合同编号：</label>
                    <div class="col-sm-4">
                        <input required="required" data-bv-message="请填写合同编号！" size="50" maxlength="50" name="contractNumber"
                               id="contractNumber"
                               alt="合同编号"
                               placeholder="请填写合同编号" type="text" title="合同编号" class="form-control"
                               onblur="contract(this)"
                               value="${editEntity.number}"/>
                        <span class="text"></span>
                    </div>
                </div>
            </div>

            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="zxc"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right"><span
                            style="color: red">*</span>课时包类型：</label>
                    <div class="col-sm-6 control-label text-align-left checkboxStyle">
                        <label>
                            <input id="zxc" type="radio" name="zxc"
                                   style="margin-right: 5px;opacity: 1;position: static;height: 18px!important;"
                                   checked="true" onclick="qinzi()">
                        </label>
                        <label style="margin-right: 10px">亲子课时包</label>
                        <label >
                            <input type="radio" name="zxc"
                                   style="margin-right: 5px;opacity: 1;position: static;height: 18px!important;"
                                   onclick="guodu()">
                        </label>
                        <label>过度课时包</label>
                    </div>
                </div>
            </div>
        </div>
        <div class="parentChild show">
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right"><span
                            style="color: red">*</span>所属顾问：</label>
                    <div class="col-sm-4">
                        <select required="required" data-bv-message="请选择所属顾问！" name="dearSonStaffId" id="dearSonStaffId"
                                class="col-sm-12 adminUserId" value=""
                                style="height: 32px;">
                        </select>

                    </div>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="dearSonGifts"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">报名费：</label>
                    <label class="col-sm-6">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;" maxlength="9"
                                   name="dearSonRegisteryFee" id="dearSonRegisteryFee" value="">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="packageId"
                           class="col-sm-3 col-sm-offset-1  control-label no-padding-right"><span
                            style="color: red">*</span>课时包名称：</label>
                    <div class="col-sm-4">
                        <select required="required" data-bv-message="请选择课时包名称！" name="dearSonPackageId"
                                id="dearSonPackageId" class="col-sm-12 addressProvince"
                                onchange="packageCheck(this)">

                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label class="col-sm-3 col-sm-offset-1 control-label no-padding-right">
                        <span style="color: red">*</span>可用课时数：</label>
                    <label class="col-sm-6">
                        <label>
                            <input required="required" data-bv-message="请填写可用课时数！" class="form-control" type="text"
                                   style="width:60px;height: 30px!important;"
                                   name="classHour" id="classHour" value="${editEntity.classHour}">
                        </label>
                        <label>
                            课时 +
                        </label>
                        <label>
                            <input required="required" data-bv-message="请填写可用课时数！" class="form-control" type="text"
                                   style="width: 40px;height: 30px!important;"
                                   name="dearSonPresentClassHour" id="dearSonPresentClassHour"
                                   value="${editEntity.presentClassHour}" onchange="giftTimeCalculation(this)">
                        </label>
                        <label>
                            赠送课时
                        </label>
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="nowUnitPrice"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">课时包原单价：</label>
                    <label class="col-sm-3">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;"
                                   name="dearSonOriginalUnitPrice" id="dearSonOriginalUnitPrice"
                                   value="${editEntity.originalUnitPrice}">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                    <label for="nowUnitPrice"
                           class="col-sm-2 control-label no-padding-right">折后单价：</label>
                    <label class="col-sm-3">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;"
                                   name="dearSonNowUnitPrice" id="dearSonNowUnitPrice"
                                   value="${editEntity.nowUnitPrice}"
                                   readonly
                                   onblur="calculation(this)">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="dearSonPackageSumPrice"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">课时包总价：</label>
                    <label class="col-sm-3">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;"
                                   name="dearSonPackageSumPrice" id="dearSonPackageSumPrice"
                                   value="${editEntity.sumPrice}">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                    <label for="dearSonPackageDiscountSumPrice"
                           class="col-sm-2 control-label no-padding-right">课时包折后总价：</label>
                    <label class="col-sm-3">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;" maxlength="9"
                                   onblur="discount(this)"
                                   name="dearSonPackageDiscountSumPrice" id="dearSonPackageDiscountSumPrice" value="">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="dearSonValidDate"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">有效期：</label>
                    <label class="col-sm-6">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;" readonly
                                   name="dearSonValidDate" id="dearSonValidDate" value="${editEntity.validDate}">
                        </label>
                        <label>
                            个月
                        </label>
                        <!--<label>
                            <button type="btn" class="btn btn-blue"
                                    style="border-color: #5db2ff!important;height:30px ;">激活
                            </button>
                        </label>
                        <small class="help-block" style="">（注：激活后将从今日起开始计算有效期）</small>-->
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="dearSonDeposit"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">已缴纳定金：</label>
                    <div class="col-sm-6">
                        <label>
                            <input class="form-control" type="text" name="dearSonDeposit" id="dearSonDeposit" readonly
                                   value="${deposit}">
                        </label>
                        <label>
                            元
                        </label>
                    </div>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="dearSonShouldPayPackagePrice"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">应支付总额：</label>
                    <label class="col-sm-3">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;" maxlength="9"
                                   name="dearSonShouldPayPackagePrice" id="dearSonShouldPayPackagePrice"
                                   readonly
                                   value="${editEntity.sumPrice}">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                    <label for="dearSonGifts"
                           class="col-sm-2  control-label no-padding-right">赠品价值：</label>
                    <label class="col-sm-3">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;" maxlength="9"
                                   name="dearSonGifts" id="dearSonGifts" value="">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12  margin-bottom-15">
                <div class="form-group">
                    <label for="dearSonTeacherId"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">试听老师：</label>
                    <div class="col-sm-6">
                        <select required="required" data-bv-message="请选择试听老师！" name="dearSonTeacherId"
                                id="dearSonTeacherId" class="col-sm-5 TeacherId" value=""
                                style="height: 32px;">
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="dearSonRemark"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">备注：</label>
                    <div class="col-sm-6">
                            <textarea class="form-control" name="dearSonRemark" size="500" maxlength="499" rows="3" style="resize:none"
                                      id="dearSonRemark" value="${editEntity.remark}"></textarea>
                    </div>
                </div>
            </div>
            <div class="col-sm-12  ">
                <div class="text-align-center">
                    <button style="width: 80px;margin-right: 20px" class="btn btn-blue" type="submit"
                            id="editFormSubmitBtn_${serializeNum}">确定
                    </button>
                    <input style="width: 80px" type="button" class="btn btn-blue" data-dismiss="modal" value="取消"/>

                </div>
            </div>
        </div>
        <div class="interim hidden">
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label  class="col-sm-3 col-sm-offset-1 control-label no-padding-right"><span
                            style="color: red">*</span>所属顾问：</label>
                    <div class="col-sm-4">
                        <select name="adminUserId" id="adminUserIdTransit" class="col-sm-12 adminUserId" value="" style="height: 32px;">
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="packageId"
                           class="col-sm-3 col-sm-offset-1  control-label no-padding-right"><span
                            style="color: red">*</span>课时包名称：</label>
                    <div class="col-sm-4">
                        <select name="packageId" id="packageId" class="col-sm-12" onchange="packageCheck(this)">
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="packageAttendanceDay" class="col-sm-3 col-sm-offset-1 control-label no-padding-right">可出勤天数：</label>
                    <div class="col-sm-6">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;" readonly
                                   name="packageAttendanceDay" id="packageAttendanceDay"
                                   value="${editEntity.classHour}">
                        </label>
                        <label>
                            天/次 + 赠送天数
                        </label>
                        <label>
                            <input class="form-control" type="text" style="width: 40px;height: 30px!important;"
                                   name="transitionGiftAttendanceDay" id="transitionGiftAttendanceDay"
                                   value="${editEntity.attendanceDay}" onchange="giftTimeCalculation(this)">
                        </label>
                        <label>
                            天/次
                        </label>
                    </div>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="nowUnitPrice"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">课时包原单价：</label>
                    <label class="col-sm-3">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;" readonly
                                   name="originalUnitPrice" id="originalUnitPrice"
                                   value="${editEntity.originalUnitPrice}">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                    <label for="nowUnitPrice"
                           class="col-sm-2 control-label no-padding-right">折后单价：</label>
                    <label class="col-sm-3">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;"
                                   name="nowUnitPrice" id="nowUnitPrice" value="${editEntity.nowUnitPrice}"
                                   readonly
                                   onblur="calculation(this)">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="packageSumPrice"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">课时包总价：</label>
                    <label class="col-sm-3">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;" readonly
                                   name="packageSumPrice" id="packageSumPrice" value="${editEntity.sumPrice}">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                    <label for="packageDiscountSumPrice"
                           class="col-sm-2 control-label no-padding-right">课时包折后总价：</label>
                    <label class="col-sm-3">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;"
                                   onblur="discount(this)"
                                   name="packageDiscountSumPrice" id="packageDiscountSumPrice" value="">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="validDate" class="col-sm-3 col-sm-offset-1 control-label no-padding-right">有效期：</label>
                    <label class="col-sm-6">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;" readonly
                                   name="validDate" id="validDate" value="${editEntity.validDate}">
                        </label>
                        <label>
                            个月
                        </label>
                        <!--<label>
                            <button type="btn" class="btn btn-blue"
                                    style="border-color: #5db2ff!important;height:30px ;">激活
                            </button>
                        </label>
                        <small class="help-block" style="">（注：激活后将从今日起开始计算有效期）</small>-->
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label class="col-sm-3 col-sm-offset-1 control-label no-padding-right"><span
                            style="color: red">*</span>课时包性质：</label>
                    <div class="col-sm-6 control-label text-align-left checkboxStyle">
                        <label >
                            <input name="nature" type="radio" value="1" style="margin-right: 5px;opacity: 1;position: static;height: 18px!important;"
                                   checked="true">
                        </label>
                        <label style="margin-right: 10px">全日</label>
                        <label >
                            <input name="nature" type="radio" value="2"
                                   style="margin-right: 5px;opacity: 1;position: static;height: 18px!important;">
                        </label>
                        <label>半日</label>
                    </div>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="packageDiscountSumPrice"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right"><span
                            style="color: red">*</span>一次性物品费：</label>
                    <label class="col-sm-6">
                        <label>
                            <input class="form-control" type="text" name="disposableItems" id="disposableItems"
                                   onchange="disposableItemsChange(this)">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="dayMealFee"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right"><span
                            style="color: red">*</span>日餐点费：</label>
                    <label class="col-sm-6">
                        <label>
                            <input class="form-control" type="text" name="dayMealFee" id="dayMealFee" value=""
                                   onchange="mealFeeCalculation(this)">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label class="col-sm-3 col-sm-offset-1 control-label no-padding-right"></label>
                    <label class="col-sm-6 checkboxStyle" >
                        <input type="hidden"  name="isComplimentaryMeals" id="isComplimentaryMeals" value="2">
                        <label>
                            <input type="checkbox" style="position: static;opacity: 1" onchange="isComplimentaryMealsChange(this)" class="inputCheckBox">
                        </label>
                        <!--onclick="isComplimentaryMealsChange(this)"-->
                        <label style="padding-top:5px;">赠送天数计材料费</label>
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="totalMealFee"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">餐点费总计：</label>
                    <label class="col-sm-6">
                        <label>
                            <input class="form-control" type="text" name="totalMealFee" id="totalMealFee" readonly>
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="deposit"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">已缴纳定金：</label>
                    <label class="col-sm-6">
                        <label>
                            <input class="form-control" type="text" name="deposit" id="deposit" value="${deposit}"
                                   readonly>
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="ShouldPayPackagePrice"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">应支付总额：</label>
                    <label class="col-sm-3">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;"
                                   name="ShouldPayPackagePrice" id="ShouldPayPackagePrice"
                                   readonly
                                   value="${editEntity.sumPrice}">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                    <label for="gifts"
                           class="col-sm-2 control-label no-padding-right">赠品价值：</label>
                    <label class="col-sm-3">
                        <label>
                            <input class="form-control" type="text" style="width:60px;height: 30px!important;"
                                   name="gifts" id="gifts" onchange="giftsChange(this)">
                        </label>
                        <label>
                            元
                        </label>
                    </label>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15 ">
                <div class="form-group">
                    <label for="teacherId"
                           class="col-sm-3 col-sm-offset-1 control-label no-padding-right">试听老师：</label>
                    <div class="col-sm-6">
                        <select required="required" data-bv-message="请选择试听老师！" name="teacherId" id="teacherId"
                                class="col-sm-5 TeacherId" value=""
                                style="height: 32px;">
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xm-12 col-sm-6 col-lg-12 margin-bottom-15">
                <div class="form-group">
                    <label for="remark" class="col-sm-3 col-sm-offset-1 control-label no-padding-right">备注：</label>
                    <div class="col-sm-6">
                            <textarea class="form-control" name="remark" id="remark" size="500" rows="3"
                                      style="resize:none"
                                      value="${editEntity.remark}"></textarea>
                    </div>
                </div>
            </div>
            <div class="col-sm-12 ">
                <div class="text-align-center">
                    <button style="width: 80px;margin-right: 20px" type="submit" class="btn btn-blue"
                            id="editFormSubmitBtn__${serializeNum}">确定
                    </button>
                    <input style="width: 80px" type="button" class="btn btn-blue" data-dismiss="modal" value="取消"/>
                </div>
            </div>
        </div>
    </form>
</div>
<script src="assets/js/validation/bootstrapValidator_init.js"></script>
<script>


    //    复选框选中事件
    function isComplimentaryMealsChange(that) {


        var packageAttendanceDay = $("#packageAttendanceDay").val();
        var packageDiscountSumPrice = $("#packageDiscountSumPrice").val();//课时包折后总价
        var transitionGiftAttendanceDay = $("#transitionGiftAttendanceDay").val();
        var packageAttendanceDay = $("#packageAttendanceDay").val();
        var dayMealFee = $("#dayMealFee").val();
        var disposableItems = $("#disposableItems").val();//一次性物品费
        var deposit = $("#deposit").val();//已缴纳定金金额
        var gifts = $("#gifts").val();//赠品价值
        if (disposableItems == '') {
            disposableItems = 0;
        }
            if (deposit == '') {
            deposit = 0;
        }
        if (gifts == '') {
            gifts = 0;
        }
        if (packageAttendanceDay == '') {
            packageAttendanceDay = 0;
        }
        if (packageAttendanceDay == '' || packageDiscountSumPrice == "" || transitionGiftAttendanceDay == '') {
            //alert("请选择课时包并填写课时包折后总价与赠送天数");
            $(that).prop("checked", false)
            logger.error("请选择课时包并填写课时包折后总价与赠送天数")
            return false;
        }
        if (dayMealFee == '') {
            //alert("请输入日餐点费");
            $(that).prop("checked", false)
            logger.error("请输入日餐点费")
            return false;
        }

        var val = $(that).prop("checked");
        if(val){
            $("#isComplimentaryMeals").val("1")
        }else{
            $("#isComplimentaryMeals").val("2")
        }

        if (val == true) {
            var sum = parseInt(packageAttendanceDay) + parseInt(transitionGiftAttendanceDay);
            $("#totalMealFee").val(sum * parseInt(dayMealFee));
            $("#ShouldPayPackagePrice").val(parseInt(packageDiscountSumPrice) - parseInt(deposit) + parseInt(sum * parseInt(dayMealFee)) + parseInt(disposableItems) + parseInt(gifts))

        } else {
            $("#totalMealFee").val(parseInt(packageAttendanceDay) * parseInt(dayMealFee));
            $("#ShouldPayPackagePrice").val(parseInt(packageDiscountSumPrice) - parseInt(deposit) + parseInt(parseInt(packageAttendanceDay) * parseInt(dayMealFee)) + parseInt(disposableItems) + parseInt(gifts))
        }
    }
    $(function () {
        var type = $(".packageType").val();
        //console.log(type);
        ajaxPackageList(type);
        ajaxStaffList();
        ajaxTeacherList(6);
        //var menu = $(".menu").val();
        //console.log(menu);
        var user = $(".user").val();
        //console.log(user);
        /* if(menu == 1){
             $(".menu").removeClass("hidden").addClass("show");
         }*/
        if (user == 1) {
            $(".user").removeClass("hidden").addClass("show");
        }
        var other = $(".other").val();
        ////alert(other);
        if (other == 1) {
            $(".other1").addClass("hidden");
        }
    });


    function qinzi() {
        $(".parentChild").removeClass("hidden").addClass("show");
        $(".interim").removeClass("show").addClass("hidden");
        $(".packageType").val(1);
        $(".attendanceDay").val("");
        var type = $(".packageType").val();
        ajaxPackageList(type)
    }

    function guodu() {
        $(".interim").removeClass("hidden").addClass("show");
        $(".parentChild").removeClass("show").addClass("hidden");
        $(".packageType").val(2);
        $(".usableTotalClassHour").val("");
        var type = $(".packageType").val();
        ajaxPackageList(type)
    }


    $(".selectpicker_${serializeNum}").select2();

    $("#toPackagerEditForm_${serializeNum}").bind("ajaxSubmitCallback", function (event, result) {
        if (result.resCode == 200) {
            var user = $(".user").val();
            bootbox.hideAll();
            logger.info("保存成功", true);
            if(user == 1){

            } else {
                toView('tssStudentController/tssStudentList.do',true,'POST',{pageSize:10})
            }
        }else {
            logger.error("保存失败");
        }
    });

    function contract(that) {
        var contractNumber = $(that).val();
        ajaxRequest("tssPaymentController/ajaxContractNumber.do", {
            contractNumber: contractNumber
        }, function (result) {
            ////alert(result.resMsg);
        }, function () {
            ajaxError("查询失败!")
        }, "get", "json")
    };

    function addPayment(that) {
        var user = $(".user").val();
        var flag = $(that).attr("flag");
        var targetdataid = $('input[name="targetdataid"]').val();
        console.log(targetdataid);
        var htmlTitle = "";
        if (flag == "1") {
            htmlTitle = "订金";
        }
        if (flag == "2") {
            htmlTitle = "课时包";
        }
        if (flag == "3") {
            htmlTitle = "其它";
        }
        bootbox.hideAll();
        console.log(flag);
        ajaxRequest("tssPaymentController/toAddedPaymentView.do", {
            flag: flag,
            targetdataid: targetdataid,
            user: user,
            other: 1
        }, function (html) {
            getTopWin().bootbox.dialog({
                message: html,
                title: htmlTitle,
                className: 'myDialog addPaymentDialog'
            });
            $(".modal-header").find(".bootbox-close-button").removeClass("close");
            $(".modal-header").find(".bootbox-close-button").html("");
        }, function () {
            ajaxError("加载页面失败!")
        }, "get", "html")
    }

    /* $(".depositBtn").click(function () {
        $(".packageType").val("");
        $(".paymentType").val(2);
        $(".deposit").removeClass("hidden").addClass("show");
        $(".parentChild").removeClass("show").addClass("hidden");
        $(".interim").removeClass("show").addClass("hidden");
        $('.depositBtn').css("background", "#5db2ff");
        $('.parentChildBtn').css("background", "#fff");
        $('.interimBtn').css("background", "#fff");
        $(".modal-title").html("定金");
        //var type = $(".packageType").val();
        //ajaxPackageList(type)
    })*/
    /*$(".parentChildBtn").click(function () {
        $(".packageType").val(1);
        $(".paymentType").val("");
        $(".parentChild").removeClass("hidden").addClass("show");
        $(".interim").removeClass("show").addClass("hidden");
        $('.parentChildBtn').css("background", "#5db2ff");
        $('.interimBtn').css("background", "#fff");
        $(".modal-title").html("亲子课时包");
        var type = $(".packageType").val();
        ajaxPackageList(type)
    })*/
    /* $(".interimBtn").click(function () {
        $(".packageType").val(2);
        $(".paymentType").val("");
        $(".parentChild").removeClass("show").addClass("hidden");
        $(".interim").removeClass("hidden").addClass("show");
        $('.parentChildBtn').css("background", "#fff");
        $('.interimBtn').css("background", "#5db2ff");
        $(".modal-title").html("过渡课时包");

        var type = $(".packageType").val();
        ajaxPackageList(type)
    })*/
    //查询用户
    function searchName() {
        var name = $('.searchName').val();
        console.log(name);
        //console.log(serializeNum);
        ajaxRequest("tssStudentController/findStudentByName.do", {
            name: name
        }, function (result) {
            var data1 = result.data;
            ////alert(result);
            ////alert(result.data);
            var arr = ['<option value="0">请选择</option>'];
            for (var i = 0; i < data1.length; i++) {
                arr.push('<option value="' + data1[i].id + '"  name="' + data1[i].name + '" adminUserId="' + data1[i].adminUserId + '" contactPhone="' + data1[i].contactPhone + '">' + data1[i].name + '</option>')
            }
            ////alert(arr);
            $(".stuId").html(arr.join(''));
        }, function () {
            html = '<p class="no-goods">无匹配数据，点击快速新建</p>';
            $('.searcher-list').html(html);
        }, "get", "json")
    };

    //选择用户
    function studentCheck(that) {
        var id = $(that).attr("id");
        var type = $(".packageType").val();
        var contactPhone = $("#stuId").find("option:selected").attr("contactPhone");
        var name = $("#stuId").find("option:selected").attr("name");
        var adminUserId = $("#stuId").find("option:selected").attr("adminUserId");

        console.log(contactPhone);
        console.log(contactPhone);
        console.log(name);
        console.log(adminUserId);


        $('input[name="stuId"]').val(id);
        $('input[name="name"]').val(name);
        $('input[name="contactPhone"]').val(contactPhone);
        $(".adminUserId").val(adminUserId);


        ajaxRequest("tssPaymentController/findDepositById.do", {
            id: id
        }, function (result) {
            var data = result.data;
            console.log(data.sumDeposit);
            console.log(data.depositIds);
            $('input[name="depositIds"]').val(data.depositIds);
            if (type == 1) {
                $('input[name="dearSonDeposit"]').val(data.sumDeposit);
            }
            if (type == 2) {
                $('input[name="deposit"]').val(data.sumDeposit);
            }


        }, function () {
            ajaxError("加载课程包失败")
        }, "get", "json")

    }

    /*    function ajaxPackageList(type) {
        ajaxRequest("tssPackageController/ajaxPackageListByType.do", {
            type: type
        }, function (result) {
            var data = result.data;
            var arr = ['<option value="0">请选择</option>'];
            if (type == 1) {
                for (var i = 0; i < data.length; i++) {
                    //arr.push('<option value="'+t.id+'">'+t.name+'</option>')
                    arr.push('<option  value="' + data[i].id + '" packageId="' + data[i].id + '" packageOriginalUnitPrice="' + data[i].originalUnitPrice + '" packageValidDate="' + data[i].validDate + '" packageTotalClassHour="' + data[i].totalClassHour + '" >' + data[i].name + '</option>')
                }
                $('#dearSonPackageId').html(arr.join(''));
            } else {
                for (var i = 0; i < data.length; i++) {
                    //arr.push('<option value="'+t.id+'">'+t.name+'</option>')
                    arr.push('<option  value="' + data[i].id + '" packageId="' + data[i].id + '" packageAttendanceDay="' + data[i].attendanceDay + '" packageValidDate="' + data[i].validDate + '" packageSumPrice="' + data[i].sumPrice + '" >' + data[i].name + '</option>')
                }
                $('#packageId').html(arr.join(''));
            }
            //$('#dearSonPackageId').html(arr.join(''))

        }, function () {
            ajaxError("加载课程包失败")
        }, "get", "json")
    }*/
    function ajaxPackageList(type) {
        ajaxRequest("tssPackageController/ajaxPackageListByType.do", {
            type: type
        }, function (result) {
            var data = result.data;
            var arr = ['<option value="0">请选择</option>'];
            if (type == 1) {
                for (var i = 0; i < data.length; i++) {
                    //arr.push('<option value="'+t.id+'">'+t.name+'</option>')
                    arr.push('<option  value="' + data[i].id + '" packageId="' + data[i].id + '" packageOriginalUnitPrice="' + data[i].originalUnitPrice + '" packageValidDate="' + data[i].validDate + '" packageTotalClassHour="' + data[i].totalClassHour + '" packageSumPrice="' + data[i].sumPrice + '" >' + data[i].name + '</option>')
                }
                $('#dearSonPackageId').html(arr.join(''));
            } else {
                for (var i = 0; i < data.length; i++) {
                    //arr.push('<option value="'+t.id+'">'+t.name+'</option>')
                    arr.push('<option  value="' + data[i].id + '" packageId="' + data[i].id + '" packageOriginalUnitPrice="' + data[i].originalUnitPrice + '" packageValidDate="' + data[i].validDate + '" packageAttendanceDay="' + data[i].attendanceDay + '" packageSumPrice="' + data[i].sumPrice + '" >' + data[i].name + '</option>')
                }
                $('#packageId').html(arr.join(''));
            }
            //$('#dearSonPackageId').html(arr.join(''))

        }, function () {
            ajaxError("加载课程包失败")
        }, "get", "json")
    }

    function ajaxStaffList() {
        ajaxRequest("sysAdminUserController/getPostListByDuty.do", {
            duty: 4
        }, function (result) {
            var data = result.data;
            var arr = ['<option value="0">请选择</option>'];
            for (var i = 0; i < data.length; i++) {
                arr.push('<option value="' + data[i].id + '">' + data[i].realName + '</option>')
            }
            $('#dearSonStaffId').html(arr.join(''));
            $('#adminUserIdTransit').html(arr.join(''));
        }, function () {
            ajaxError("加载员工信息失败");
        }, "post", "json")
    };

    function ajaxTeacherList(duty) {
        ajaxRequest("sysAdminUserController/getPostListByDuty.do", {
            duty: duty
        }, function (result) {
            var data = result.data;
            var arr = ['<option value="0">请选择</option>'];
            for (var i = 0; i < data.length; i++) {
                arr.push('<option value="' + data[i].id + '">' + data[i].realName + '</option>')
            }
            $('#dearSonTeacherId').html(arr.join(''));
            $('#teacherId').html(arr.join(''));
        }, function () {
            ajaxError("加载员工信息失败");
        }, "post", "json")
    };

    //选择课时包
    function packageCheck(that) {
        var id = $(that).attr("id");
        if (id == 'dearSonPackageId') {
            var packageId = $("#dearSonPackageId").find("option:selected").attr("packageId");
            var packageOriginalUnitPrice = $("#dearSonPackageId").find("option:selected").attr("packageOriginalUnitPrice");
            var packageTotalClassHour = $("#dearSonPackageId").find("option:selected").attr("packageTotalClassHour");
            var packageValidDate = $("#dearSonPackageId").find("option:selected").attr("packageValidDate");
            var packageSumPrice = $("#dearSonPackageId").find("option:selected").attr("packageSumPrice");

            console.log(packageId);
            console.log(packageOriginalUnitPrice);
            console.log(packageValidDate);
            console.log(packageTotalClassHour);

            $('input[name="dearSonOriginalUnitPrice"]').eq(0).val(packageOriginalUnitPrice);
            $('input[name="classHour"]').eq(0).val(packageTotalClassHour);
            $('input[name="dearSonPackageSumPrice"]').eq(0).val(packageSumPrice);
            $('input[name="dearSonValidDate"]').eq(0).val(packageValidDate);
        } else {
            var packageId = $("#packageId").find("option:selected").attr("packageId");
            var packageOriginalUnitPrice = $("#packageId").find("option:selected").attr("packageOriginalUnitPrice");
            var packageAttendanceDay = $("#packageId").find("option:selected").attr("packageAttendanceDay");
            var packageValidDate = $("#packageId").find("option:selected").attr("packageValidDate");
            var packageSumPrice = $("#packageId").find("option:selected").attr("packageSumPrice");

            console.log(packageOriginalUnitPrice);

            $('input[name="originalUnitPrice"]').eq(0).val(packageOriginalUnitPrice);
            $('input[name="packageAttendanceDay"]').eq(0).val(packageAttendanceDay);
            $('input[name="packageSumPrice"]').eq(0).val(packageSumPrice);
            $('input[name="validDate"]').eq(0).val(packageValidDate);


        }
    }

    //计算课程包总价
    function calculation(that) {
        var type = $(".packageType").val();
        console.log("type:" + type);
        if (type == 1) {
            var nowUnitPrice = $(that).val();
            console.log("nowUnitPrice:" + nowUnitPrice);

            var packageTotalClassHour = $('input[name="classHour"]').val();
            console.log("packageTotalClassHour:" + packageTotalClassHour);

            var sum = nowUnitPrice * packageTotalClassHour;
            console.log("sum:" + sum);

            var deposit = $('input[name="dearSonDeposit"]').val();
            console.log("deposit:" + deposit);

            sum = sum - deposit;
            console.log("sum:" + sum);

            $('input[name="dearSonSumPrice"]').val(sum);
        } else {
            var nowUnitPrice = $(that).val();
            console.log("nowUnitPrice:" + nowUnitPrice);

            var packageAttendanceDay = $('input[name="packageAttendanceDay"]').val();
            console.log("packageAttendanceDay:" + packageAttendanceDay);

            var sum = nowUnitPrice * packageAttendanceDay;
            console.log("sum:" + sum);

            var deposit = $('input[name="deposit"]').val();
            console.log("deposit:" + deposit);

            sum = sum - deposit;
            console.log("sum:" + sum);

            $('input[name="sumPrice"]').val(sum);

        }
    }

    //计算课程包总价
    function discount(that) {
        var type = $(".packageType").val();
        console.log("type:" + type);
        if (type == 1) {
            var dearSonPackageDiscountSumPrice = $(that).val();
            console.log("dearSonPackageDiscountSumPrice:" + dearSonPackageDiscountSumPrice);

            var packageTotalClassHour = $("#classHour").val();
            console.log("packageTotalClassHour:" + packageTotalClassHour);

            var deposit = $("#dearSonDeposit").val();
            console.log("deposit:" + deposit);

            //sum = parseInt(sum)-parseInt(deposit);
//            var sum = parseInt(sum)-parseInt(deposit);
            //console.log("sum:" + sum);
            //$("#dearSonSumPrice").val(sum);
            var sum = dearSonPackageDiscountSumPrice;
            sum = sum - deposit;
            console.log("sum:" + sum);
            $("#dearSonShouldPayPackagePrice").val(sum);

            var discountPrice = (dearSonPackageDiscountSumPrice / packageTotalClassHour).toFixed(2);
            console.log("discountPrice:" + discountPrice);
            $("#dearSonNowUnitPrice").val(discountPrice);
        } else {
            var packageDiscountSumPrice = $(that).val();//课时包折后总价
            var packageAttendanceDay = $("#packageAttendanceDay").val();
            var deposit = $("#deposit").val();
            var sum = packageDiscountSumPrice - deposit;
            var discountPrice = (packageDiscountSumPrice / packageAttendanceDay).toFixed(2);
            $("#nowUnitPrice").val(discountPrice);
            var disposableItems = $("#disposableItems").val();//一次性物品费
            var deposit = $("#deposit").val();//已缴纳定金金额
            var gifts = $("#gifts").val();//赠品价值
            var totalMealFee = $("#totalMealFee").val();//餐点费总计
            if (disposableItems == '') {
                disposableItems = 0;
            }
            if (deposit == '') {
                deposit = 0;
            }
            if (gifts == '') {
                gifts = 0;
            }
            if (totalMealFee == '') {
                totalMealFee = 0;
            }
            if (packageDiscountSumPrice == '') {
                packageDiscountSumPrice = 0;
            }

            $("#ShouldPayPackagePrice").val(parseInt(packageDiscountSumPrice) - parseInt(deposit) + parseInt(totalMealFee) + parseInt(disposableItems) + parseInt(gifts))

        }
    }

    //计算总可用课程数
    function giftTimeCalculation(that) {
        var type = $(".packageType").val();
        console.log("type:" + type);
        if($(that).val()==''){
            $("#isComplimentaryMeals").val("2");
            $(".inputCheckBox").prop("checked",false)
        }
        if (type == 1) {
            var classHour = $('input[name="classHour"]').val();
            console.log("classHour:" + classHour);
            if (classHour == "") {
                //alert("请先选择课时包")
            }
            var dearSonPresentClassHour = $(that).val();
            console.log("dearSonPresentClassHour:" + dearSonPresentClassHour);

            var sum = parseInt(dearSonPresentClassHour) + parseInt(classHour);
            console.log("sum:" + sum);
            $('input[name="usableTotalClassHour"]').val(sum);
        } else {
            var isComplimentaryMeals = $("#isComplimentaryMeals").prop("checked");
            var packageAttendanceDay = $('input[name="packageAttendanceDay"]').val();
            if (packageAttendanceDay == "") {
                //alert("请先选择课时包")
            }
            var transitionGiftAttendanceDay = $(that).val();
            var sum = parseInt(packageAttendanceDay) + parseInt(transitionGiftAttendanceDay);
            $('input[name="attendanceDay"]').val(sum);
            var packageAttendanceDay = $("#packageAttendanceDay").val();
            var packageDiscountSumPrice = $("#packageDiscountSumPrice").val();//课时包折后总价
            var gifts = $("#gifts").val();//赠品价值
            var deposit = $("#deposit").val();//已缴纳定金金额
            var disposableItems = $("#disposableItems").val();
            var dayMealFee = $("#dayMealFee").val();
            if (dayMealFee == '') {
                dayMealFee = 0;
            }
            if (deposit == '') {
                deposit = 0;
            }
            if (gifts == '') {
                gifts = 0;
            }
            if (disposableItems == '') {
                disposableItems = 0;
            }
            if (packageDiscountSumPrice == '') {
                packageDiscountSumPrice = 0;
            }
            if (packageAttendanceDay == '') {
                packageAttendanceDay = 0;
            }
            var currentVal = $(that).val();
            if (currentVal == '') {
                currentVal = 0;
            }
            if (isComplimentaryMeals == true) {
                var sum = parseInt(currentVal) + parseInt(packageAttendanceDay);
                $("#totalMealFee").val(sum * dayMealFee);
                $("#ShouldPayPackagePrice").val(parseInt(packageDiscountSumPrice) - parseInt(deposit) + parseInt(sum * dayMealFee) + parseInt(disposableItems) + parseInt(gifts))
            }

        }
    }

    //计算餐点费
    function mealFeeCalculation(that) {
        var packageAttendanceDay = $("#packageAttendanceDay").val();
        var packageDiscountSumPrice = $("#packageDiscountSumPrice").val();//课时包折后总价
        var dayMealFee = $(that).val();
        if (packageAttendanceDay == "" || packageDiscountSumPrice == "") {
            //alert("请选择课时包并填写课时包折后总价");
            $(that).val("")
            return false;
        }
        var checkedBox = $("#isComplimentaryMeals").prop("checked");

        var sum = 0;
        var daysum;
        var transitionGiftAttendanceDay = $("#transitionGiftAttendanceDay").val();
        if (transitionGiftAttendanceDay == '') {
            transitionGiftAttendanceDay = 0
        }
        if (checkedBox == true) {
            daysum = parseInt(packageAttendanceDay) + parseInt(transitionGiftAttendanceDay);
        } else {
            daysum = parseInt(packageAttendanceDay);
        }
        sum = daysum * dayMealFee;//餐点费总计金额
        $("#totalMealFee").val(sum);
        var deposit = $("#deposit").val();//已缴纳定金金额
        var disposableItems = $("#disposableItems").val();//一次性物品费
        if (disposableItems == '') {
            disposableItems = 0;
        }
        var gifts = $("#gifts").val();//赠品价值
        if (gifts == '') {
            gifts = 0;
        }
        var newSum = parseInt(packageDiscountSumPrice) - parseInt(deposit) + parseInt(sum) + parseInt(disposableItems) + parseInt(gifts);

        $("#ShouldPayPackagePrice").val(newSum);
    }

    //    一次性用品改变事件
    function disposableItemsChange(that) {
        var packageAttendanceDay = $("#packageAttendanceDay").val();
        var packageDiscountSumPrice = $("#packageDiscountSumPrice").val();//课时包折后总价
        var disposableItems = $(that).val();//一次性物品费
        if (packageAttendanceDay == "" || packageDiscountSumPrice == "") {
            //alert("请选择课时包并填写课时包折后总价");
            $(that).val("")
            return false;
        }
        var totalMealFee = $("#totalMealFee").val();//餐点费总计金额
        var gifts = $("#gifts").val();//赠品价值
        var deposit = $("#deposit").val();//已缴纳定金金额
        if (disposableItems == '') {
            disposableItems = 0;
        }
        if (packageDiscountSumPrice == '') {
            packageDiscountSumPrice = 0;
        }
        if (totalMealFee == '') {
            totalMealFee = 0;
        }
        if (gifts == '') {
            gifts = 0;
        }
        if (deposit == '') {
            deposit = 0;
        }
        $("#ShouldPayPackagePrice").val(parseInt(packageDiscountSumPrice) - parseInt(deposit) + parseInt(totalMealFee) + parseInt(disposableItems) + parseInt(gifts));

    }

    //    赠品价值改变事件
    function giftsChange(that) {
        var packageAttendanceDay = $("#packageAttendanceDay").val();
        var packageDiscountSumPrice = $("#packageDiscountSumPrice").val();//课时包折后总价
        var gifts = $(that).val();//赠品价值
        if (packageAttendanceDay == "" || packageDiscountSumPrice == "") {
            //alert("请选择课时包并填写课时包折后总价");
            $(that).val("")
            return false;
        }
        var totalMealFee = $("#totalMealFee").val();//餐点费总计金额
        var disposableItems = $("#disposableItems").val();//一次性物品费
        var deposit = $("#deposit").val();//已缴纳定金金额
        if (gifts == '') {
            gifts = 0;
        }
        if (packageDiscountSumPrice == '') {
            packageDiscountSumPrice = 0;
        }
        if (totalMealFee == '') {
            totalMealFee = 0;
        }
        if (disposableItems == '') {
            disposableItems = 0;
        }
        if (deposit == '') {
            deposit = 0;
        }
        $("#ShouldPayPackagePrice").val(parseInt(packageDiscountSumPrice) - parseInt(deposit) + parseInt(totalMealFee) + parseInt(disposableItems) + parseInt(gifts));

    }



    //    弹出层放大缩小
    function expandView() {
        $(".modal-dialog").toggleClass("expandView");
        $(".modal-content").toggleClass("expandView");
        $(".bootboxs").toggleClass("bootbox");
    }

    /*function packageCheck(that) {
        var id = $(that).attr("id");
        if (id == 'dearSonPackageId') {
            var packageId = $("#dearSonPackageId").find("option:selected").attr("packageId");
            var packageOriginalUnitPrice = $("#dearSonPackageId").find("option:selected").attr("packageOriginalUnitPrice");
            var packageValidDate = $("#dearSonPackageId").find("option:selected").attr("packageValidDate");
            var packageTotalClassHour = $("#dearSonPackageId").find("option:selected").attr("packageTotalClassHour");

            console.log(packageId);
            console.log(packageOriginalUnitPrice);
            console.log(packageValidDate);
            console.log(packageTotalClassHour);

            $('input[name="classHour"]').eq(0).val(packageTotalClassHour);
            $('input[name="originalUnitPrice"]').eq(0).val(packageOriginalUnitPrice);
            $('input[name="dearSonValidDate"]').eq(0).val(packageValidDate);
        } else {
            var packageId = $("#packageId").find("option:selected").attr("packageId");
            var packageAttendanceDay = $("#packageId").find("option:selected").attr("packageAttendanceDay");
            var packageSumPrice = $("#packageId").find("option:selected").attr("packageSumPrice");
            var packageValidDate = $("#packageId").find("option:selected").attr("packageValidDate");


            $('input[name="attendanceDay"]').eq(0).val(packageAttendanceDay);
            $('input[name="sumPrice"]').eq(0).val(packageSumPrice);
            $('input[name="validDate"]').eq(0).val(packageValidDate);


        }
    }*/

    /*function calculation(that) {
        var nowUnitPrice = $(that).val();
        console.log("nowUnitPrice:" + nowUnitPrice);
        var packageTotalClassHour = $('input[name="classHour"]').val();
        console.log("packageTotalClassHour:" + packageTotalClassHour);
        var sum = nowUnitPrice * packageTotalClassHour;
        console.log("sum:" + sum);
        $('input[name="sumPrice"]').val(sum);
    }*/

    /*function offer(that) {
        var discountedPrice = $(that).val();
        console.log("discountedPrice:" + discountedPrice);
        var dearSonSumPrice = $('#dearSonSumPrice').val();
        console.log("dearSonSumPrice:" + dearSonSumPrice);
        var sum = dearSonSumPrice - discountedPrice;
        console.log("sum:" + sum);
        $('input[name="amount"]').val(sum);
    }*/
</script>